#! /usr/bin/python
import os
import sys

customer = [4,5,8,11]
part = [4,5,8,11]
supplier = [5,8,11]

c_index = 2
p_index = 3
s_index = 4

rle = "./rleCompression"
dict = "./dictCompression"
sort = "./columnSort"

cmd="make sort"
print cmd
os.system(cmd)

cmd="make rle"
print cmd
os.system(cmd)

cmd="make dict"
print cmd
os.system(cmd)

cmd = sort + " LINEORDER CLINEORDER " + str(c_index)
print cmd
os.system(cmd)
cmd="chmod 755 CLINEORDER*"
os.system(cmd)

cmd = sort + " LINEORDER PLINEORDER " + str(p_index)
print cmd
os.system(cmd)
cmd="chmod 755 PLINEORDER*"
os.system(cmd)

cmd = sort + " LINEORDER SLINEORDER " + str(s_index)
print cmd
os.system(cmd)
cmd="chmod 755 SLINEORDER*"
os.system(cmd)

cmd = rle + " CLINEORDER" + str(c_index) + " CCLINEORDER" + str(c_index)
print cmd
os.system(cmd)

cmd = rle + " PLINEORDER" + str(p_index) + " PPLINEORDER" + str(p_index)
print cmd
os.system(cmd)

cmd = rle + " SLINEORDER" + str(s_index) + " SSLINEORDER" + str(s_index)
print cmd
os.system(cmd)


for i in customer:
    input = "CLINEORDER" + str(i)
    output = "CCLINEORDER" + str(i)
    cmd = dict + " " + input + " " + output
    print cmd
    os.system(cmd)

cmd="chmod 755 CCLINEORDER*"
os.system(cmd)

for i in part:
    input = "PLINEORDER" + str(i)
    output = "PPLINEORDER" + str(i)
    cmd = dict + " " + input + " " + output
    print cmd
    os.system(cmd)

cmd="chmod 755 PPLINEORDER*"
os.system(cmd)

for i in supplier:
    input = "SLINEORDER" + str(i)
    output = "SSLINEORDER" + str(i)
    cmd = dict + " " +input + " " + output
    print cmd
    os.system(cmd)

cmd="chmod 755 SSLINEORDER*"
os.system(cmd)

